package beans;

import java.util.ArrayList;
import java.util.List;

public class ProjectsBean {
	private List<ProjectItemBean> projectItemsList;
	
	public ProjectsBean() {
		projectItemsList = new ArrayList<ProjectItemBean>();
	}
	
	public void addRow(ProjectItemBean projectItemBean) {
		projectItemsList.add(projectItemBean);
	}
	
	public String getJson() {
		StringBuffer sb = new StringBuffer();

		sb.append("{ ");
		sb.append("\"row\": [");
		for (int i = 0; i < projectItemsList.size(); i++) {
			
			ProjectItemBean projectItemBean = projectItemsList.get(i);
			sb.append(projectItemBean.getJson());
			
			if (i != projectItemsList.size() - 1) {
				sb.append(",");
			}
		}
		sb.append("]");
		sb.append("}");
					
		return sb.toString();
	}
}
